package cn.tedu._05mvcboot06.common.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer state;
    private String message;
    private Object date;
    public JsonResult(StatusCode statusCode){
        this.state=statusCode.getState();
        this.message=statusCode.getMessage();
    }
    public JsonResult(StatusCode statusCode,Object date){
        this.state=statusCode.getState();
        this.message=statusCode.getMessage();
        this.date=date;
    }
    public static JsonResult ok(Object date){
        return new JsonResult(StatusCode.OPERATION_SUCCESS,date);
    }
    public static JsonResult ok(){
        return ok(null);
    }
}
